#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <netdb.h>
#include <netinet/in.h>
#include <sys/socket.h>

int main(void)
{
	struct addrinfo hints, *res=NULL;
	int rc;
	memset(&hints, 0, sizeof(hints));
	//set the parameters in the struct addrinfo
	hints.ai_family=PF_UNSPEC;
	hints.ai_socktype=SOCK_DGRAM;
	hints.ai_protocol=IPPROTO_UDP;	
	//invoke getaddinfo function
	rc = getaddrinfo("127.0.0.1", "123",&hints, &res);
	if(rc != 0)
	{
		perror("getaddinfo");
		exit(1);
	}
	else
	{
		printf("getaddrinfo success\n");
	}
}

